home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 February
/
Macworld (1999-02).dmg
/
Shareware World
/
Shareware Feature
/
PageSpinner 2.0.1
/
Examples
/
JavaScript
/
Scrolling Text Stationery
< prev
next >
Wrap
Text File
|
1997-06-17
|
3KB
|
95 lines
<HTML>
<HEAD>
<TITLE>JavaScript Scrolling Text</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -----
/*
WARNING! This script example contains an error that may cause
Netscape to crash on certain systems.
Use the script with care!
Copyright (C)1996 Web Integration Systems, Inc. DBA Websys, Inc.
All Rights Reserved.
This applet can be re-used or modified, if credit is given in
the source code. We will not be held responsible for any unwanted
effects due to the usage of this applet or any derivative.
No warrantees for usability for any specific application are given
or implied.
Chris Skinner, January 30th, 1996.
Hacked for CNNfn by RD, Jan. 31, 1996
*/
function scrollit(seed)
{
var m1 = "This is an example of scrolling text using JavaScript";
var m2 = " . . . you can put your own message here to get attention";
var m3 = " . . . Please enjoy PageSpinner! ";
var msg=m1+m2+m3;
var out = " ";
var c = 1;
if (seed > 100) {
seed--;
var cmd="scrollit(" + seed + ")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 100 && seed > 0) {
for (c=0 ; c < seed ; c++) {
out+=" ";
}
out+=msg;
seed--;
var cmd="scrollit(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 0) {
if (-seed < msg.length) {
out+=msg.substring(-seed,msg.length);
seed--;
var cmd="scrollit(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
}
else {
window.status=" ";
timerTwo=window.setTimeout("scrollit(100)",75);
}
}
}
// -- End of JavaScript code -------------- -->
</SCRIPT>
</HEAD>
<BODY onLoad="timerONE=window.setTimeout('scrollit(100)',500);">
<H1>JavaScript Scrolling Text</H1>
<B>This stationary page contains a Java that displays a scrolling message in the status area in Netscape Navigator 2.0. </B>
<P>
<FONT COLOR="DD0000">
<PRE>WARNING! This script example contains an error that may cause
Netscape to crash on certain systems. Use the script with care!
</PRE>
</FONT>
The script is named <B>scrollit</B> and it is placed in the HEAD section of the HTML document. It is executed inside the BODY start tag:
<XMP><BODY onLoad="timerONE=window.setTimeout('scrollit(100)',500);"></XMP>
Replace the text inside the script with your own message and edit the page or copy the entire script to an existing page:
<XMP>function scrollit(seed)
{
var m1 = "This is an axemple of scrolling text using JavaScript";
var m2 = " . . . you can put your own message here to get attention";
var m3 = " . . . Please enjoy PageSpinner! ";</XMP>
<HR>
</BODY>
</HTML>